package com.yanqu.road.server.cmd.activity.peakseacraft;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.PeakSeacraftProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.cmd.CrossUnionCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.server.manager.activity.peakseacraft.PeakSeacraftMgr;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.CrossProtocol;
import com.yanqu.road.utils.YanQuMessageUtils;

/**
 * @Description
 */
@Cmd(code = CrossProtocol.C_PEAK_SEACRAFT_GET_MEMBER_BATTLE_DETAIL, desc = "海上争霸 南海丝路 查看船只成员详细攻防数据")
public class CrossPeakSeacraftGetMemberBattleDetailCmd extends CrossUnionCommand {

    long userId;
    int activityId;
    String unionId;
    int sonType;
    int type;
    String targetId;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        PeakSeacraftProto.PeakSeacraftGetMemberBattleDetailReqMsg reqMsg = PeakSeacraftProto.PeakSeacraftGetMemberBattleDetailReqMsg.parseFrom(packet.getBytes());
        userId = packet.getPlayerId();
        activityId = reqMsg.getActivityId();
        unionId = reqMsg.getUnionId();
        sonType = reqMsg.getSonType();
        type = reqMsg.getType();
        targetId = reqMsg.getTargetId();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        YanQuMessage pbMsg = YanQuMessageUtils.buildMessage(ClientProtocol.U_PEAK_SEACRAFT_GET_MEMBER_BATTLE_DETAIL,
                PeakSeacraftMgr.getMemberBattleDetail(activityId, type, unionId, sonType, targetId));
        MessageHelper.sendPacket(serverId, userId, pbMsg);
    }

    @Override
    public void sendData() {

    }
}
